package CB_C19;

import javafx.scene.control.*;

import javafx.scene.CustomNode;
import javafx.scene.Group;
import javafx.scene.Node;

/**define on/off Effect strenght*/
public var checkBox : CheckBox;
/**indicates the current Strength slider position*/
var Label2 : Label;
/**displays "Strength"*/
var Label1 : Label;
/**slider: controls strength of the framedrop effect 0-5
* @defaultvalue 0
*/
public var frames : Slider;
/**if checked, triggers a random selection of frameblocks removed 
* @defaultvalue false
*/
public var random : CheckBox;

/**Strength
 * Created on 10.11.2009. <br>
 <br>
 Represents the Strength Slider and the random Checkbox
 *<br>
 * @author Sebastian Czekierski, Stefan Blumberger
 *
 */
 
public class gui_Strength extends CustomNode
{
    override function create(): Node
    {
        return Group
        {
            content:
            [
                Label1 = Label
                {
                    width: 80;
                    translateX: checkBox.width + checkBox.translateX;
                    translateY: 5;
                    text: "Strength:";
                }
                frames = Slider
                {
                     translateX: Label1.width + Label1.translateX +10;
                     translateY: 5;
                     width: 300;
                     min: 0;
                     max: 5;
                     vertical: false;
                     onMouseEntered: function(MouseEvent)
                     {
                         var a : MyEffect;
                         a = Main.p.effect.getControl("anzahl") as MyEffect;
                         a.SetStrength(frames.value as Integer);
                     }
                     onMouseExited: function(MouseEvent)
                     {
                         var a : MyEffect;
                         a = Main.p.effect.getControl("anzahl") as MyEffect;
                         a.SetStrength(frames.value as Integer);
                     }

                }
                Label2 = Label
                {
                    translateX: frames.width + frames.translateX +10;
                    translateY: 5;
                    text: bind "{frames.value as Integer} frames";
                    width: 60;
                }
                random = CheckBox
                {
                        translateX: Label2.width +Label2.translateX +10;
                        translateY: 5;
                        text: " Random"
                        allowTriState: false;
                        selected: false;
                        onMouseEntered: function(MouseEvent)
                        {
                         var a : MyEffect;
                         a = Main.p.effect.getControl("random") as MyEffect;
                         a.SetRandom(random.selected);
                        }
                        onMouseExited: function(MouseEvent)
                        {
                         var a : MyEffect;
                         a = Main.p.effect.getControl("random") as MyEffect;
                         a.SetRandom(random.selected);
                     }
                }
            ]
        }
    }
}

